/**
 * @author Created by qiush on 2017-06-30.
 */

import * as React from 'react';
import {ComponentDecorator, connect} from 'react-redux';

import {IChildSelectionMergedProps, IChildSelectionOwnProps, mapStateToProps} from './IChildSelection';
import AbsOneChildVisiblePane from './AbsOneChildVisiblePane';

/**
 * 简单的切换的处理, 没有做动画效果, 只是直接显示当前选中的组件(如果选中的组件是这个的直接子组件的话)
 */
class Slider extends AbsOneChildVisiblePane {
  render() {
    return (
      <div className="Slider">
        {this.renderChildren()}
      </div>
    );
  }
}

type SliderDecorator = ComponentDecorator<IChildSelectionMergedProps, IChildSelectionOwnProps>;
const componentDecorator: SliderDecorator = connect(mapStateToProps);
export default componentDecorator(Slider);
